﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;

namespace DataImporterExporter
{
    [Serializable]
    public class ObjectsToSerialize<T> : ISerializable
    {

        public ObjectsToSerialize()
        {
        }

        public ObjectsToSerialize(SerializationInfo info, StreamingContext context)
        {
            Type type = typeof(ICollection<T>);
            ItemList = (ICollection<T>)info.GetValue(type.Name, type);
        }

        public ICollection<T> ItemList { get; set; }

        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            Type type = typeof(ICollection<T>);
            info.AddValue(type.Name, ItemList);
        }
    }
}
